package com.xzx.annotation.bean;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanPostProcessor;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author xinzhixuan
 * @version 1.0
 * @date 2025/4/18 12:04
 */
@Slf4j
public class Person06 implements InitializingBean, DisposableBean {

    public Person06() {
      log.info("=====Person06 constructor");
    }

    public void init1() {
      log.info("=====@Bean注解的 initMethod方法");
    }

    public void destroy1() {
      log.info("=====@Bean注解的 destroyMethod方法");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("=====InitializingBean afterPropertiesSet");
    }

    @Override
    public void destroy() throws Exception {
        log.info("=====DisposableBean destroy");
    }

    @PostConstruct
    public void init2() {
        log.info("=====@PostConstruct init");
    }

    @PreDestroy
    public void destroy2() {
        log.info("=====@PreDestroy destroy");
    }
}
